/*
 ============================================================================
 Name        : util.h
 Author      : Ana Roig & Pablo Abad
 Version     : 1.0
 Description : Utilidades varias compartidas (header)
 ============================================================================
 */


#ifndef UTIL_H_
#define UTIL_H_

#include <stdio.h>
#include <stdlib.h> 
#include <openssl/sha.h>
#include <openssl/evp.h>

#define	FILE_SIZE		320

FILE* safefopen(const char *name, char *mode);
int readfile(const char *filePath, char ** dest, int maxSize);

void calculateHash(unsigned char result[SHA_DIGEST_LENGTH], char *message);

void byte2hex(char *dest, unsigned char *source, int size);
void hex2byte(unsigned char *dest, char *source, int size);

int checkASCII(char *str, int len);

#endif /* UTIL_H_ */

